import 'package:flutter_homemonitor/generated/json/base/json_convert_content.dart';
import 'package:flutter_homemonitor/model/all_detect_item_entity.dart';

AllDetectItemEntity $AllDetectItemEntityFromJson(Map<String, dynamic> json) {
  final AllDetectItemEntity allDetectItemEntity = AllDetectItemEntity();
  final int? id = jsonConvert.convert<int>(json['Id']);
  if (id != null) {
    allDetectItemEntity.id = id;
  }
  final String? itemCode = jsonConvert.convert<String>(json['ItemCode']);
  if (itemCode != null) {
    allDetectItemEntity.itemCode = itemCode;
  }
  final String? itemName = jsonConvert.convert<String>(json['ItemName']);
  if (itemName != null) {
    allDetectItemEntity.itemName = itemName;
  }
  final String? city = jsonConvert.convert<String>(json['City']);
  if (city != null) {
    allDetectItemEntity.city = city;
  }
  final String? district = jsonConvert.convert<String>(json['District']);
  if (district != null) {
    allDetectItemEntity.district = district;
  }
  final String? createTime = jsonConvert.convert<String>(json['CreateTime']);
  if (createTime != null) {
    allDetectItemEntity.createTime = createTime;
  }
  final String? updateTime = jsonConvert.convert<String>(json['UpdateTime']);
  if (updateTime != null) {
    allDetectItemEntity.updateTime = updateTime;
  }
  final String? memo = jsonConvert.convert<String>(json['Memo']);
  if (memo != null) {
    allDetectItemEntity.memo = memo;
  }
  final String? itemStats = jsonConvert.convert<String>(json['ItemStats']);
  if (itemStats != null) {
    allDetectItemEntity.itemStats = itemStats;
  }
  final dynamic reportNumber = json['ReportNumber'];
  if (reportNumber != null) {
    allDetectItemEntity.reportNumber = reportNumber;
  }
  final dynamic inspectionType = json['InspectionType'];
  if (inspectionType != null) {
    allDetectItemEntity.inspectionType = inspectionType;
  }
  final dynamic projectManagerID = json['ProjectManagerID'];
  if (projectManagerID != null) {
    allDetectItemEntity.projectManagerID = projectManagerID;
  }
  final dynamic address = json['Address'];
  if (address != null) {
    allDetectItemEntity.address = address;
  }
  final dynamic projectState = json['ProjectState'];
  if (projectState != null) {
    allDetectItemEntity.projectState = projectState;
  }
  final dynamic implementation = json['Implementation'];
  if (implementation != null) {
    allDetectItemEntity.implementation = implementation;
  }
  final dynamic inTime = json['InTime'];
  if (inTime != null) {
    allDetectItemEntity.inTime = inTime;
  }
  final dynamic progress = json['Progress'];
  if (progress != null) {
    allDetectItemEntity.progress = progress;
  }
  final dynamic analysis = json['Analysis'];
  if (analysis != null) {
    allDetectItemEntity.analysis = analysis;
  }
  final double? contractId = jsonConvert.convert<double>(json['ContractId']);
  if (contractId != null) {
    allDetectItemEntity.contractId = contractId;
  }
  final dynamic editAssociatedData = json['EditAssociatedData'];
  if (editAssociatedData != null) {
    allDetectItemEntity.editAssociatedData = editAssociatedData;
  }
  final List<dynamic>? buildingList =
      (json['BuildingList'] as List<dynamic>?)?.map((e) => e).toList();
  if (buildingList != null) {
    allDetectItemEntity.buildingList = buildingList;
  }
  return allDetectItemEntity;
}

Map<String, dynamic> $AllDetectItemEntityToJson(AllDetectItemEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['Id'] = entity.id;
  data['ItemCode'] = entity.itemCode;
  data['ItemName'] = entity.itemName;
  data['City'] = entity.city;
  data['District'] = entity.district;
  data['CreateTime'] = entity.createTime;
  data['UpdateTime'] = entity.updateTime;
  data['Memo'] = entity.memo;
  data['ItemStats'] = entity.itemStats;
  data['ReportNumber'] = entity.reportNumber;
  data['InspectionType'] = entity.inspectionType;
  data['ProjectManagerID'] = entity.projectManagerID;
  data['Address'] = entity.address;
  data['ProjectState'] = entity.projectState;
  data['Implementation'] = entity.implementation;
  data['InTime'] = entity.inTime;
  data['Progress'] = entity.progress;
  data['Analysis'] = entity.analysis;
  data['ContractId'] = entity.contractId;
  data['EditAssociatedData'] = entity.editAssociatedData;
  data['BuildingList'] = entity.buildingList;
  return data;
}

extension AllDetectItemEntityExtension on AllDetectItemEntity {
  AllDetectItemEntity copyWith({
    int? id,
    String? itemCode,
    String? itemName,
    String? city,
    String? district,
    String? createTime,
    String? updateTime,
    String? memo,
    String? itemStats,
    dynamic reportNumber,
    dynamic inspectionType,
    dynamic projectManagerID,
    dynamic address,
    dynamic projectState,
    dynamic implementation,
    dynamic inTime,
    dynamic progress,
    dynamic analysis,
    double? contractId,
    dynamic editAssociatedData,
    List<dynamic>? buildingList,
  }) {
    return AllDetectItemEntity()
      ..id = id ?? this.id
      ..itemCode = itemCode ?? this.itemCode
      ..itemName = itemName ?? this.itemName
      ..city = city ?? this.city
      ..district = district ?? this.district
      ..createTime = createTime ?? this.createTime
      ..updateTime = updateTime ?? this.updateTime
      ..memo = memo ?? this.memo
      ..itemStats = itemStats ?? this.itemStats
      ..reportNumber = reportNumber ?? this.reportNumber
      ..inspectionType = inspectionType ?? this.inspectionType
      ..projectManagerID = projectManagerID ?? this.projectManagerID
      ..address = address ?? this.address
      ..projectState = projectState ?? this.projectState
      ..implementation = implementation ?? this.implementation
      ..inTime = inTime ?? this.inTime
      ..progress = progress ?? this.progress
      ..analysis = analysis ?? this.analysis
      ..contractId = contractId ?? this.contractId
      ..editAssociatedData = editAssociatedData ?? this.editAssociatedData
      ..buildingList = buildingList ?? this.buildingList;
  }
}
